package cn.netjava.wk;

import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FileFilterAction implements FileFilter {

	public boolean accept(File pathname) {
		
		return pathname.getName().matches(".+\\.java");
//		return pathname.getName().endsWith(".java");
	}
	public static void main(String[] args){
		File file = new File("D:\\tt\\");
		File[] ff = file.listFiles(new FileFilterAction());
		
		
		
		
		List<File> list = Arrays.asList(ff);
		Iterator<File> it = list.iterator();
		while (it.hasNext()) {
			System.out.println(((File) it.next()).getName());
		}
	}
	

}
